package com.jarvis.pzz.modules.completed;

import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;

import com.jarvis.pzz.R;
import com.jarvis.pzz.common.BaseActivity;
import com.jarvis.pzz.models.ShopListModel;
import com.jarvis.pzz.modules.recommend.RecommendActivity;
import com.jarvis.pzz.modules.recommend.RecommendFindActivity;
import com.jarvis.pzz.util.SharePreferenceKey;

import java.io.Serializable;
import java.util.List;

import butterknife.BindView;

public class ReleaseCompletedActivity extends BaseActivity implements View.OnClickListener {
    @BindView(R.id.ll_return)
    LinearLayout ll_return;
    @BindView(R.id.ll_see)
    LinearLayout ll_see;
    private List<ShopListModel> shopsListByFilterModels;

    @Override
    public int getLayoutId() {
        return R.layout.activity_release_completed;
    }

    @Override
    public void initData() {

    }

    @Override
    public void initView() {
        Intent _intent = getIntent();
        if(_intent!=null) {
            shopsListByFilterModels = (List<ShopListModel>) _intent.getSerializableExtra("RENT_SHOP_LIST");
        }
        onclickListener();
    }
    private void onclickListener(){
        ll_return.setOnClickListener(this);
        ll_see.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ll_return:
                finish();
                break;
            case R.id.ll_see:
                if(SharePreferenceKey.SHOP_STATE==3||SharePreferenceKey.SHOP_STATE==5){
                    startActivity(RecommendActivity.class);
                    finish();
                }else{
                    if(shopsListByFilterModels!=null) {
                        Intent intent = new Intent(mActivity, RecommendFindActivity.class);
                        intent.putExtra("RENT_SHOP_LIST", (Serializable) shopsListByFilterModels);
                        startActivity(intent);
                        finish();
                    }else {
                        showTextToast("没有推荐铺源信息");
                    }
                }

                break;
        }
    }
}
